<!DOCTYPE html>
<meta charset="UTF-8">
		      <table
			     class="easyui-datagrid"   
			     id="datagridd"  
		         url="${base}/user/getUserMessage?id=${id}"
		         pagination="true"
		         rownumbers="true" 
		         data-options="pageSize:20,pageList:[2,10,20,30]" 
		         >  
		    <thead>  
		        <tr> 
		        	<th data-options="field:'read',align:'center'" formatter="formatRead" width="8%">状态</th>
		        	<th data-options="field:'type',align:'center'" formatter="formatType" width="8%">类型</th>
		        	<th data-options="field:'createTime',align:'center'" formatter="formatDate" width="8%">时间</th>
		        	<th data-options="field:'messageInfo',align:'center'" formatter="formatName" width="8%">发送者</th>
		            <th data-options="field:'messageInfo.content',formatter: function (value, rec) { if(rec.messageInfo['content'].indexOf('，')>-1){var str = rec.messageInfo['content'].substring(0,rec.messageInfo['content'].indexOf('，')); return str;}else{return rec.messageInfo['content'];}}" width="67%">内容</th>
		        	
		        </tr>
		    </thead>
		</table>    
<script>
    function formatRead(value){
    	if( value == 0){
    		return "未读";
    	}
    	if( value == 1){
    		return "已读";
    	}
    }
    
    function formatType(value){
		if( value == 'notify'){
			return "通知";		
    	}
		if( value == 'user'){
			return "用户消息";
		}
		if( value == 'remind'){
			return "提醒";
		}
    }
    
    function formatName(value){
    	return value.senderUname;
    }
    
    function formatDate(value){
    	var unixTimestamp = new Date(value)
    	return unixTimestamp.format("yyyy-MM-dd");
    }

    
</script>


